package greedy.总结.基础;

public class leetcode122买卖股票的最佳时机2 {
    public int maxProfit(int[] prices) {
        int earn = 0;
        for (int i = 1; i < prices.length; i++) {
            if (prices[i] > prices[i - 1]){
                earn += prices[i] - prices[i-1];
            }
        }
        return earn;
    }
}
